home *** CD-ROM | disk | FTP | other *** search
/ Mission 3 / Mission 3.zip / Mission 3.iso / texte / 7up_pd / warrange.c < prev    next >
C/C++ Source or Header  |  1998-10-29  |  5KB  |  202 lines

  1. /* Fenster anordnen */
  2. /*****************************************************************************
  3. *
  4. *                                              7UP
  5. *                                      Modul: WARRANGE.C
  6. *                                     (c) by TheoSoft '95
  7. *
  8. *****************************************************************************/
  9. #include <portab.h>
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <stdarg.h>
  13. #include <string.h>
  14. #if GEMDOS
  15. #include <tos.h>
  16. #else
  17. #include <alloc.h>
  18. #endif
  19. #include <aes.h>
  20. #include <vdi.h>
  21.  
  22. #include "7up.h"
  23. #include "windows.h"
  24. #include "undo.h"
  25.  
  26. extern WINDOW _wind[MAXWINDOWS];
  27.  
  28. typedef struct
  29. {
  30.   GRECT rect[MAXWINDOWS];
  31. }TWindpos;
  32.  
  33. void Warrange(int how)
  34. {
  35.    TWindpos pos;
  36.    int i,k,xd,yd,wd,hd;
  37.  
  38.    wind_get(0,WF_WORKXYWH,&xd,&yd,&wd,&hd);
  39.  
  40.    switch(Wcount(OPENED))
  41.    {
  42.       case 1:
  43.          pos.rect[1].g_x = xd;
  44.          pos.rect[1].g_y = yd;
  45.          pos.rect[1].g_w = wd;
  46.          pos.rect[1].g_h = hd;
  47.  
  48.          break;
  49.       case 2:
  50.          pos.rect[1].g_x = xd;
  51.          pos.rect[1].g_y = yd;
  52.          pos.rect[1].g_w = wd;
  53.          pos.rect[1].g_h = hd/2;
  54.  
  55.          pos.rect[2].g_x = xd;
  56.          pos.rect[2].g_y = yd+hd/2;
  57.          pos.rect[2].g_w = wd;
  58.          pos.rect[2].g_h = hd/2;
  59.  
  60.          break;
  61.       case 3:
  62.          pos.rect[1].g_x = xd;
  63.          pos.rect[1].g_y = yd;
  64.          pos.rect[1].g_w = wd;
  65.          pos.rect[1].g_h = hd/3;
  66.  
  67.          pos.rect[2].g_x = xd;
  68.          pos.rect[2].g_y = yd+hd/3;
  69.          pos.rect[2].g_w = wd;
  70.          pos.rect[2].g_h = hd/3;
  71.  
  72.          pos.rect[3].g_x = xd;
  73.          pos.rect[3].g_y = yd+2*hd/3;
  74.          pos.rect[3].g_w = wd;
  75.          pos.rect[3].g_h = hd/3;
  76.  
  77.          break;
  78.       case 4:
  79.          pos.rect[1].g_x = xd;
  80.          pos.rect[1].g_y = yd;
  81.          pos.rect[1].g_w = wd/2;
  82.          pos.rect[1].g_h = hd/2;
  83.  
  84.          pos.rect[2].g_x = xd;
  85.          pos.rect[2].g_y = yd+hd/2;
  86.          pos.rect[2].g_w = wd/2;
  87.          pos.rect[2].g_h = hd/2;
  88.  
  89.          pos.rect[3].g_x = xd+wd/2;
  90.          pos.rect[3].g_y = yd;
  91.          pos.rect[3].g_w = wd/2;
  92.          pos.rect[3].g_h = hd/2;
  93.  
  94.          pos.rect[4].g_x = xd+wd/2;
  95.          pos.rect[4].g_y = yd+hd/2;
  96.          pos.rect[4].g_w = wd/2;
  97.          pos.rect[4].g_h = hd/2;
  98.  
  99.          break;
  100.       case 5:
  101.          pos.rect[1].g_x = xd;
  102.          pos.rect[1].g_y = yd;
  103.          pos.rect[1].g_w = wd/2;
  104.          pos.rect[1].g_h = hd/2;
  105.  
  106.          pos.rect[2].g_x = xd;
  107.          pos.rect[2].g_y = yd+hd/2;
  108.          pos.rect[2].g_w = wd/2;
  109.          pos.rect[2].g_h = hd/2;
  110.  
  111.          pos.rect[3].g_x = xd+wd/2;
  112.          pos.rect[3].g_y = yd;
  113.          pos.rect[3].g_w = wd/2;
  114.          pos.rect[3].g_h = hd/3;
  115.  
  116.          pos.rect[4].g_x = xd+wd/2;
  117.          pos.rect[4].g_y = yd+hd/3;
  118.          pos.rect[4].g_w = wd/2;
  119.          pos.rect[4].g_h = hd/3;
  120.  
  121.          pos.rect[5].g_x = xd+wd/2;
  122.          pos.rect[5].g_y = yd+2*hd/3;
  123.          pos.rect[5].g_w = wd/2;
  124.          pos.rect[5].g_h = hd/3;
  125.  
  126.          break;
  127.       case 6:
  128.          pos.rect[1].g_x = xd;
  129.          pos.rect[1].g_y = yd;
  130.          pos.rect[1].g_w = wd/2;
  131.          pos.rect[1].g_h = hd/3;
  132.  
  133.          pos.rect[2].g_x = xd;
  134.          pos.rect[2].g_y = yd+hd/3;
  135.          pos.rect[2].g_w = wd/2;
  136.          pos.rect[2].g_h = hd/3;
  137.  
  138.          pos.rect[3].g_x = xd;
  139.          pos.rect[3].g_y = yd+2*hd/3;
  140.          pos.rect[3].g_w = wd/2;
  141.          pos.rect[3].g_h = hd/3;
  142.  
  143.          pos.rect[4].g_x = xd+wd/2;
  144.          pos.rect[4].g_y = yd;
  145.          pos.rect[4].g_w = wd/2;
  146.          pos.rect[4].g_h = hd/3;
  147.  
  148.          pos.rect[5].g_x = xd+wd/2;
  149.          pos.rect[5].g_y = yd+hd/3;
  150.          pos.rect[5].g_w = wd/2;
  151.          pos.rect[5].g_h = hd/3;
  152.  
  153.          pos.rect[6].g_x = xd+wd/2;
  154.          pos.rect[6].g_y = yd+2*hd/3;
  155.          pos.rect[6].g_w = wd/2;
  156.          pos.rect[6].g_h = hd/3;
  157.  
  158.          break;
  159.       case 7:
  160.          pos.rect[1].g_x = xd;
  161.          pos.rect[1].g_y = yd;
  162.          pos.rect[1].g_w = wd/2;
  163.          pos.rect[1].g_h = hd/3;
  164.  
  165.          pos.rect[2].g_x = xd;
  166.          pos.rect[2].g_y = yd+hd/3;
  167.          pos.rect[2].g_w = wd/2;
  168.          pos.rect[2].g_h = hd/3;
  169.  
  170.          pos.rect[3].g_x = xd;
  171.          pos.rect[3].g_y = yd+2*hd/3;
  172.          pos.rect[3].g_w = wd/2;
  173.          pos.rect[3].g_h = hd/3;
  174.  
  175.          pos.rect[4].g_x = xd+wd/2;
  176.          pos.rect[4].g_y = yd;
  177.          pos.rect[4].g_w = wd/2;
  178.          pos.rect[4].g_h = hd/4;
  179.  
  180.          pos.rect[5].g_x = xd+wd/2;
  181.          pos.rect[5].g_y = yd+hd/4;
  182.          pos.rect[5].g_w = wd/2;
  183.          pos.rect[5].g_h = hd/4;
  184.  
  185.          pos.rect[6].g_x = xd+wd/2;
  186.          pos.rect[6].g_y = yd+2*hd/4;
  187.          pos.rect[6].g_w = wd/2;
  188.          pos.rect[6].g_h = hd/4;
  189.  
  190.          pos.rect[7].g_x = xd+wd/2;
  191.          pos.rect[7].g_y = yd+3*hd/4;
  192.          pos.rect[7].g_w = wd/2;
  193.          pos.rect[7].g_h = hd/4;
  194.  
  195.          break;
  196.    }
  197.    for(i=1, k=1; i<MAXWINDOWS; i++)
  198.       if(_wind[i].w_state & CREATED && _wind[i].w_state & OPENED)
  199.          if(pos.rect[k].g_w && pos.rect[k].g_h)
  200.             Wmovesize(&_wind[i],&pos.rect[k++]);
  201. }
  202.